package com.csjung.games.gamenori.server.domain;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Game {

  public static Game findGame(Long id) {
    if (id == null) {
      return null;
    }

    EMF emf = EMF.get();
    Game game = emf.ofy().find(Game.class, id);
    return game;
  }
  
  @Id
  Long id;
  
  private User createUser;
  
  private User contactUser;
  
  private String GameType;
  
  private String roomName;
  
  private Integer version = 0;
  
  /**
   * Persist this object in the data store.
   */
  public void persist() {
    EMF emf = EMF.get();

    ++version;
    emf.ofy().put(this);
    
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public User getCreateUser() {
    return createUser;
  }

  public void setCreateUser(User createUser) {
    this.createUser = createUser;
  }

  public User getContactUser() {
    return contactUser;
  }

  public void setContactUser(User contactUser) {
    this.contactUser = contactUser;
  }

  public String getGameType() {
    return GameType;
  }

  public void setGameType(String gameType) {
    GameType = gameType;
  }

  public String getRoomName() {
    return roomName;
  }

  public void setRoomName(String roomName) {
    this.roomName = roomName;
  }

  public Integer getVersion() {
    return version;
  }

  public void setVersion(Integer version) {
    this.version = version;
  }
  
}
